{"ast":null,"code":"var _s = $RefreshSig$();\nimport React from 'react';\nexport const Title = chats => {\n  _s();\n  const [title] = React.useState(`${process.env.REACT_APP_NAME_PROJECT}`);\n  const [countMessage, setCountMessage] = React.useState(0);\n  const getTotalUnreadCountMessages = chats => {\n    setCountMessage(0);\n    chats.items.forEach(items => {\n      if (items.unreadMessageCounter) {\n        setCountMessage(countMessage + items.unreadMessageCounter);\n      }\n    });\n  };\n  React.useEffect(() => {\n    getTotalUnreadCountMessages(chats);\n    countMessage > 0 ? document.title = `(${countMessage}) ` + title : document.title = title;\n  }, [chats, title]);\n};\n_s(Title, \"gODdS20bkaqFMeLvv2x5nFPqI78=\");\n_c = Title;\nexport default Title;\nvar _c;\n$RefreshReg$(_c, \"Title\");","map":{"version":3,"names":["React","Title","chats","title","useState","process","env","REACT_APP_NAME_PROJECT","countMessage","setCountMessage","getTotalUnreadCountMessages","items","forEach","unreadMessageCounter","useEffect","document"],"sources":["/data/messenger.client/src/utils/Title.tsx"],"sourcesContent":["import React from 'react';\nimport {ChatsListResponse} from \"../models/response/ChatsListResponse\";\n\nexport const Title = (chats: ChatsListResponse): void => {\n    const [title] = React.useState<string>(`${process.env.REACT_APP_NAME_PROJECT}`);\n    const [countMessage, setCountMessage] = React.useState<number>(0);\n\n    const getTotalUnreadCountMessages = (chats: ChatsListResponse) => {\n        setCountMessage(0);\n\n        chats.items.forEach((items) => {\n            if (items.unreadMessageCounter!) {\n                setCountMessage(countMessage + items.unreadMessageCounter);\n            }\n        });\n    }\n\n    React.useEffect(() => {\n        getTotalUnreadCountMessages(chats);\n\n        countMessage > 0?\n            document.title = `(${countMessage}) ` + title:\n            document.title = title;\n    }, [chats, title]);\n};\n\nexport default Title;"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAO,MAAMC,KAAK,GAAIC,KAAwB,IAAW;EAAA;EACrD,MAAM,CAACC,KAAK,CAAC,GAAGH,KAAK,CAACI,QAAQ,CAAU,GAAEC,OAAO,CAACC,GAAG,CAACC,sBAAuB,EAAC,CAAC;EAC/E,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGT,KAAK,CAACI,QAAQ,CAAS,CAAC,CAAC;EAEjE,MAAMM,2BAA2B,GAAIR,KAAwB,IAAK;IAC9DO,eAAe,CAAC,CAAC,CAAC;IAElBP,KAAK,CAACS,KAAK,CAACC,OAAO,CAAED,KAAK,IAAK;MAC3B,IAAIA,KAAK,CAACE,oBAAoB,EAAG;QAC7BJ,eAAe,CAACD,YAAY,GAAGG,KAAK,CAACE,oBAAoB,CAAC;MAC9D;IACJ,CAAC,CAAC;EACN,CAAC;EAEDb,KAAK,CAACc,SAAS,CAAC,MAAM;IAClBJ,2BAA2B,CAACR,KAAK,CAAC;IAElCM,YAAY,GAAG,CAAC,GACZO,QAAQ,CAACZ,KAAK,GAAI,IAAGK,YAAa,IAAG,GAAGL,KAAK,GAC7CY,QAAQ,CAACZ,KAAK,GAAGA,KAAK;EAC9B,CAAC,EAAE,CAACD,KAAK,EAAEC,KAAK,CAAC,CAAC;AACtB,CAAC;AAAC,GArBWF,KAAK;AAAA,KAALA,KAAK;AAuBlB,eAAeA,KAAK;AAAC;AAAA"},"metadata":{},"sourceType":"module"}